<template>
    <div id="root">
        <Top><p>搜索地址</p></Top>

        <van-field required v-model="addschool" center clearable size="10px" placeholder="小区/写字楼/学校等">
            <template #button>
                <van-button size="small" type="info" @click="shou()">确认</van-button>
            </template>
        </van-field>
        <p class="ti-p">为了满足商家的送餐要求，建议您从列表中选择地址</p>
        <div class="show-root">
            <div v-for="(v,k) in shuju" :key="k" class="show" @click="lok(v)">
                <h5>{{v.name}}</h5>
                <p>{{v.address}}</p>
            </div>
        </div>

    </div>
</template>

<script>
    import Top from "./Top";

    export default {
        name: "AddSite",
        components: {Top},
        data() {
            return {
                addschool: "",
                shuju:""
            }
        },
        methods: {

            shou() {
                console.log(JSON.parse(localStorage.user).id);
                this.axios.get("https://elm.cangdu.org/v1/pois?city_id=" +localStorage.SityId+ "&keyword=" + this.addschool).then(data => {

                   this.shuju=data.data;

                }).catch(error => {
                    console.log(error)
                });
            },
            lok(v){
                this.$parent.$emit("addsite2",v)
                // this.$router.push("/myuser/shipping/addshipp")
              this.$router.go(-1)
            }
        },
    }
</script>

<style scoped>
    #root {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        background-color: #f5f5f5;
        /*z-index: 999;*/
    }
    .show{
        padding-left: 20px;
        padding-right: 20px;
        margin: 0 auto;
        padding-top: .65rem;
        padding-bottom: .65rem;
        border-bottom: 1px solid #e4e4e4;
        color: darkgray;
    }
    .show p{
        margin-top: 3px;

        font-size: 6px;
        /*background-color: blue;*/
    }
    .ti-p{
        background: #fff6e4;
        font-size: .62rem;
        color: #ff883f;
        text-align: center;
        padding: .2rem 0;
    }
</style>